import { Newable } from '../../utilities/newable';
import { Component } from '../components/component';
import { EventComponent } from '../components/event.component';
import { Entity } from '../entities/entity';

export interface IWorld {
  findEntitiesByComponent(componentClass: Newable<Component>): Entity[];

  findEntitiesByComponents(componentClasses: Newable<Component>[]): Entity[];

  findComponentByEntity<T extends Component>(entity: Entity, componentClass: Newable<T>): T | null;

  findComponentsByEntity(entity: Entity): Component[];

  addEntity(entity: Entity): void;

  removeEntity(entity: Entity): void;

  attachComponentToEntity<T extends Component>(componentClass: Newable<T>, componentInstance: T, entity: Entity): void;

  detachComponentFromEntity(componentClass: Newable<Component>, entity: Entity): void;

  pushEvent<T extends EventComponent>(componentClass: Newable<T>, componentInstance: T): void;
}
